//
//  MainViewController.m
//  LMTestPatchDemo
//
//  Created by mengmenglu on 4/15/16.
//  Copyright © 2016 Hangzhou TaiXuan Network Technology Co., Ltd. All rights reserved.
//

#import "MainViewController.h"
#import "NewViewController.h"

@implementation MainViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    self.title = @"主页";
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self setupSubViews];
    
}
- (void)didReceiveMemoryWarning {
    
    [super didReceiveMemoryWarning];
}

- (void)setupSubViews {
    
    UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    leftButton.frame = CGRectMake(100, 100, 100, 50);
    [leftButton setTitle:@"更新补丁" forState:UIControlStateNormal];
    [leftButton setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [leftButton addTarget:self action:@selector(leftBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:leftButton];
    
    
    UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
    rightButton.frame = CGRectMake(200, 100, 100, 50);
    [rightButton setTitle:@"修复补丁" forState:UIControlStateNormal];
    [rightButton setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [rightButton addTarget:self action:@selector(rightBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:rightButton];
    
}


- (void)leftBtnClick:(UIButton *)button {
    
    NSLog(@"更新补丁");
    [LMPatchManager updatePatchFiles];
}


- (void)rightBtnClick:(UIButton *)button {
    
    NSLog(@"修复补丁");
    NewViewController *subViewController = [[NewViewController alloc] init];
    [self.navigationController pushViewController:subViewController animated:YES];
    
}

@end
